package org.gl.training.gwt.server.utils;

import java.util.List;

import org.gl.training.gwt.shared.model.DailyPlanVO;
import org.gl.training.gwt.shared.model.TaskVO;
import org.gl.training.planner.model.DailyPlan;

public class DailyPlanVOUtils {

	public static DailyPlanVO getDailyPlanVO(DailyPlan dailyPlan) {
		if (dailyPlan == null) {
			return null;
		}
		DailyPlanVO dailyPlanVO = new DailyPlanVO();
		dailyPlanVO.setId(dailyPlan.getId());
		dailyPlanVO.setDate(dailyPlan.getDate());
		dailyPlanVO.setUserId(dailyPlan.getUser().getId());

		List<TaskVO> taskVOs = TaskVOUtils.getTaskVOs(dailyPlan.getTaskList());
		dailyPlanVO.setTaskVOList(taskVOs);

		return dailyPlanVO;
	}

}
